package settings.dao.impl;

import java.util.*; 

import settings.model.*;
import org.springframework.orm.hibernate3.support.HibernateDaoSupport;
import settings.dao.*;

public class TableDaoHibernate extends HibernateDaoSupport
	implements TableDao
{
	public Table getById(Integer id)
	{
		return (Table)getHibernateTemplate()
			.get(Table.class , id);
	}

	public Table getByNumber(Integer number)
	{
		return (Table)getHibernateTemplate()
			.get(Table.class , number);
	}
	
	public Integer save(Table table)
	{
		return (Integer)getHibernateTemplate()
			.save(table);
	}

	public void update(Table table)
	{
		getHibernateTemplate()
			.update(table);
	}

	public void delete(Table table)
	{
		getHibernateTemplate()
			.delete(table);
	}

	public void delete(Integer id)
	{
		getHibernateTemplate()
			.delete(getById(id));
	}

	public List<Table> findAll()
	{
		return (List<Table>)getHibernateTemplate().find("from Table");
	}
}
